--沉狂浸想
local chengkuangjingxiang = fk.CreateSkill {
    name = "mcdh_chengkuangjingxiang"
}

chengkuangjingxiang:addEffect(fk.TargetSpecified,{
    can_trigger=function (self, event, target, player, data)
        return player:hasSkill(chengkuangjingxiang.name) and target == player and data.to ~= player and player:usedSkillTimes(chengkuangjingxiang.name) == 0
    end,
    on_cost=function (self, event, target, player, data)
        local room = player.room
        local logic = room.logic
        local n = 0
        local useEvent = logic:getCurrentEvent()
        local events = logic.event_recorder[GameEvent.UseCard] or Util.DummyTable
        for i = #events, 1, -1 do
            local e = events[i]
            if e.data.from == player and e.id < useEvent.id then
                if table.contains(e.data.tos,data.to) then
                    n = n+1
                else
                    break
                end
            end
        end
        if n ~= 0 then
            event:setCostData(self,n)
            return room:askToSkillInvoke(player,{prompt="#chengkuangjingxiang:::"..n,skill_name=chengkuangjingxiang.name})
        end  
    end,
    on_use=function (self, event, target, player, data)
        local n = math.min(event:getCostData(self),3)
        player:drawCards(n,chengkuangjingxiang.name)
    end
})

Fk:loadTranslationTable {
    ["mcdh_chengkuangjingxiang"] = "沉狂浸想",
    [":mcdh_chengkuangjingxiang"] = "每回合限一次，当你使用牌指定其他角色为目标后，你可以摸X张牌。(X为你对该角色此前连续使用牌的次数且至多为3)",
    ["#chengkuangjingxiang"] = "沉狂浸想:摸%arg张牌",
}

return chengkuangjingxiang